<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class User extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        "username" => "require|max:20",
        // "email" => "email",
        // "nickname" => "require | max:20",
        "password" => "require|max:20",
        "comfirmPassword" => "require|max:20"
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        "username.require" => "账户不得为空",
        // "email.email" => "邮箱格式错误",
        "username.max" => "姓名不得大于20位",
        // "nickname.require" => "用户名不得为空",
        "password.require" => "密码不得为空",
        "password.max" => "密码不得大于20位",
    ];

    /**
     * 定义验证场景
     * 
     * 
     */
    protected $scene = [
        "login" => ["username","password"],
        "register" => ["username","password","comfirmPassword"],
    ];
}
